import request from '../utils/request-new'

export type VideoItem = {
  id: string,
  name: string,
  hospital: string
}

export const getVideoList = (data: {
  pageNum?: number,
  pageSize?: number,
  title?: string,
  status?: string
}) => {
  return request({
    url: '/video/list',
    method: 'GET',
    data: {
      ...data,
      status: typeof data.status === 'undefined' ? 1 : data.status
    }
  })
}

// 获取详细
export const getVideoDetail = (data: {
  videoId: string
}) => {
  return request({
    url: `/video/${data.videoId}`,
    method: 'GET'
  })
}

export const getMyVideoList = (data: {
  pageNum?: number,
  pageSize?: number
}) => {
  return request({
    url: '/video/mineList',
    method: 'GET',
    data
  })
}

export type videoType = {
  "id" ?: number,
  "userId": number,
  "title": string,
  "hospital": string,
  "name": string,
  "detail": string,
  "videoUrl": string,
  "thumb": string
}

export const addVideo = (data: videoType) => {
  return request({
    url: '/video',
    method: 'POST',
    data
  })
}

export const modifyVideo = (data: videoType) => {
  return request({
    url: '/video',
    method: 'PUT',
    data
  })
}
